<?php
$servername = 'localhost';
$username = 'username';
$password = 'password';
$dbname = 'projectDB';

// 创建连接
$connect = mysqli_connect($servername, $username, $password);
 
// 检测连接
if (!$connect) {
    die("Connection failed: " . mysqli_connect_error() . "<br />");
} else {
    echo "连接成功" . "<br />";
}

// 创建数据库
$sql = "CREATE DATABASE $dbname";
$retval = mysqli_query($connect, $sql);
if ($retval) {
    echo "数据库创建成功" . "<br />";
} else {
    echo "Error creating database: " . mysqli_error($connect) . "<br />";
}

mysqli_close($connect);
?>